package apache;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;


/**
 * 单例缓存
 *
 */
public class ApplicationCache {
	private ConcurrentMap<String, Object> cacheMap = null;
	private static class Singleton {
		private static final ApplicationCache singleton = new ApplicationCache();
	}

	public static final ApplicationCache getInstance() {
		return Singleton.singleton;
	}
	private ApplicationCache() {
		cacheMap = new ConcurrentHashMap<String, Object>();
	}
	/**
	 * @Title: put
	 * @Description: 添加数据到缓存中 ,永不过期
	 * @param key 数据主键
	 * @param value 需要缓存的数据
	 * @return void 返回类型
	 * @throws
	 */
	public void put(String key, Object value) {
	   	cacheMap.put(key, value);
	}
	
	public Object get(String key) {
		return cacheMap.get(key);
	}
}
